package vn.fpt.fsoft.entities;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * Author:	DuongPV1
 * Entity ReferenceData mapping with table ReferenceData in database
 * 
 * */
@Entity
@Table(name="ReferenceData")
public class ReferenceData {
	private int refId;
	private String refCode;
	private String refValue;
	private Set<Organisation> organisations=new HashSet<Organisation>(0);
	private Set<Service> services=new HashSet<Service>(0);
	public ReferenceData() {
		// TODO Auto-generated constructor stub
	}
	
	/**
	 * @param refId
	 * @param refCode
	 * @param refValue
	 */
	public ReferenceData(int refId, String refCode, String refValue) {
		super();
		this.refId = refId;
		this.refCode = refCode;
		this.refValue = refValue;
	}
	@Id
	@Column(name="RefId",nullable=false,unique=true)
	public int getRefId() {
		return refId;
	}
	public void setRefId(int refId) {
		this.refId = refId;
	}
	@Column(name="RefCode",nullable=true)
	public String getRefCode() {
		return refCode;
	}
	public void setRefCode(String refCode) {
		this.refCode = refCode;
	}
	@Column(name="Value",nullable=true)
	public String getRefValue() {
		return refValue;
	}
	public void setRefValue(String refValue) {
		this.refValue = refValue;
	}
	@ManyToMany(fetch=FetchType.LAZY,mappedBy="referenceData")
	public Set<Organisation> getOrganisations() {
		return organisations;
	}

	public void setOrganisations(Set<Organisation> organisations) {
		this.organisations = organisations;
	}
	@ManyToMany(fetch=FetchType.LAZY,mappedBy="referenceData")
	public Set<Service> getServices() {
		return services;
	}

	public void setServices(Set<Service> services) {
		this.services = services;
	}
	
	
	
}
